home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / lib / pm-utils / module.d / tuxonice < prev    next >
Text File  |  2009-10-06  |  1KB  |  37 lines

  1. #!/bin/sh
  2.  
  3. export TUXONICE_LOC
  4. # TODO tuxonice supports all sorts of knobs to twiddle. Since this should be as
  5. # simple as possible, it does not provide a mechanism for twiddling those knobs.
  6. # If you need more customization than this file has, consider using a hook to
  7. # set the appropriate values.
  8.  
  9. # more locations might be nice
  10. for loc in "/sys/power/tuxonice" "/sys/power/suspend2"; do
  11.     [ -d "${loc}" ] && { TUXONICE_LOC="${loc}"; break; }
  12. done 
  13.  
  14. if [ -z "$HIBERNATE_MODULE" -a -n "$TUXONICE_LOC" ] && \
  15.     [ -f "${TUXONICE_LOC}/do_hibernate" ]; then
  16.     HIBERNATE_MODULE="tuxonice"
  17.     do_hibernate()
  18.     {
  19.         echo 5 > "${TUXONICE_LOC}/powerdown_method"
  20.         echo anything > "${TUXONICE_LOC}/do_hibernate"
  21.     }
  22. fi
  23.  
  24. if [ -z "$SUSPEND_HYBRID_MODULE" -a -n "$TUXONICE_LOC" ] && \
  25.     grep -q mem /sys/power/state && \
  26.     [ -f "${TUXONICE_LOC}/do_hibernate" ]; then
  27.     SUSPEND_HYBRID_MODULE="tuxonice"
  28.     do_suspend_hybrid()
  29.     {
  30.         echo 3 >"${TUXONICE_LOC}/powerdown_method"
  31.         echo anything >"${TUXONICE_LOC}/do_hibernate"
  32.         [ -f /sys/power/tuxonice/did_suspend_to_both ] && \
  33.             [ "$(cat /sys/power/tuxonice/did_suspend_to_both)" != "1" ] && \
  34.             REVERSE="thaw"
  35.     }
  36. fi
  37.